package com.course02.order_backend.controller.llh;

import com.course02.order_backend.entity.llh.Result;
import com.course02.order_backend.exception.llh.BusinessException;
import com.course02.order_backend.exception.llh.ErrorCode;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

//测试订单出错处理
@RestController
public class OrderController {
    @GetMapping("/order/{id}")
    public Result getOrder( @PathVariable Long id){
       if(id==999L){
           throw new BusinessException(ErrorCode.TABLE_NOT_EXIST,"桌号"+id);
       }
       return Result.success("订单信息"+id);
    }
}
